package cn.edu.njuit.lesson9heros.myioc;

import cn.edu.njuit.lesson9heros.pojo.Team;
import cn.edu.njuit.lesson9heros.service.GameService;
import cn.edu.njuit.lesson9heros.service.TeamService;

/**
 * MyIOC的游戏启动类
 */
@MyComponent(name="iocStarter")
public class MyIocStarter {
    @MyAutowired
    TeamService teamService;
    @MyAutowired
    GameService gameService;
    public void start(){
        Team blueTeam=teamService.getTeam(null);
        Team redTeam=teamService.getTeam(blueTeam);

        gameService.play(blueTeam,redTeam);
    }

    public static void main(String[] args){
        //初始化容器
        MyComponentFactory.initComponents();
        MyIocStarter starter=(MyIocStarter)MyComponentFactory.getComponent("iocStarter");
        starter.start();
    }
}
